
/**
 * 
 * A class that handles all of the different result types and stores custom data for each. 
 *
 */
public abstract class Result extends BaphiListItem {
	
	public enum Type { EnableActivity, DisableActivity, AddCargo, RemoveCargo, AddInventory, RemoveInventory, CargoMarket,
		ExoticMarket, ItemMarket, DroneMarket, CargoBayExpansion, PhaseLoss, Reading, Combat, Error };
}

/**
 * 
 * EnableActivity: Result containing list of activities to be enabled
 *
 */
class EnableActivity extends Result {
	int activity[];
	
	/**
	 * EnableActivity: Result containing list of activities to be enabled
	 * @param activities
	 */
	EnableActivity(int[] activities)
	{
		activity = activities;
	}
}

/**
 * 
 * DisableActivity: Result containing list of activities to be disabled
 *
 */
class DisableActivity extends Result {
	int activity[];
	
	/**
	 * DisableActivity: Result containing list of activities to be disabled
	 * @param activities
	 */
	DisableActivity(int[] activities)
	{
		activity = activities;
	}
}

/**
 * 
 * AddCargo: Result containing list of cargo to load on player's ship
 *
 */
class AddCargo extends Result {
	CargoList cargoList;
	
	/**
	 * AddCargo: Result containing list of cargo to load on player's ship
	 * @param cargoList
	 */
	AddCargo(CargoList cargoList)
	{
		this.cargoList = cargoList;
	}
}

/**
 * 
 * RemoveCargo: Result containing how many units of carge to remove from a player's ship, and whether or not they get to choose which ones.
 *
 */
class RemoveCargo extends Result {
	boolean random;
	int quantity;
	
	/**
	 * RemoveCargo: Result containing how many units of carge to remove from a player's ship, and whether or not they get to choose which ones.
	 * @param random
	 * @param quantity
	 */
	RemoveCargo(boolean random, int quantity)
	{
		this.random = random;
		this.quantity = quantity;
	}
	
	/**
	 * 
	 * @return true if the cargo to be lost is chosen randomly
	 */
	boolean isRandom()
	{
		return random;
	}
	
	/**
	 * 
	 * @return number of units to be lost
	 */
	int getQuantity()
	{
		return quantity;
	}
}

/**
 * 
 * AddInventory: Result containing list of inventory to give a player
 *
 */
class AddInventory extends Result {
	int inventory[];
	
	/**
	 * AddInventory: Result containing list of inventory to give a player
	 * @param inventory
	 */
	AddInventory(int[] inventory)
	{
		this.inventory = inventory;
	}
}

/**
 * 
 * RemoveInventory: Result containing list of inventory to take from a player
 *
 */
class RemoveInventory extends Result {
	int inventory[];
	
	/**
	 * RemoveInventory: Result containing list of inventory to take from a player
	 * @param inventory
	 */
	RemoveInventory(int[] inventory)
	{
		this.inventory = inventory;
	}
}

/**
 * 
 * CargoMarket: Result containing the cargo commodity offered for sale, what they will take in trade, and what each trade is worth.
 *
 */
class CargoMarket extends Result {
	int cargoForSale;
	CargoList cargoList;
	
	/**
	 * CargoMarket: Result containing the cargo commodity offered for sale, what they will take in trade, and what each trade is worth.
	 * @param cargoForSale - the cargo type this market sells
	 * @param cargoList - a list of what they will take in trade, and how many units of their cargo they will offer in exchange for one unit of each of the commodities in this list
	 */
	CargoMarket(int cargoForSale, CargoList cargoList)
	{
		this.cargoForSale = cargoForSale;
		this.cargoList = cargoList;
	}	
}

/**
 * 
 * ExoticMarket: Result containing an exotic commodity and what one unit sells for
 *
 */
class ExoticMarket extends Result {
	int cargoForSale;
	CargoList cargoList;
	
	/**
	 * ExoticMarket: Result containing an exotic commodity and what one unit sells for
	 * @param cargoForSale
	 * @param cargoList - list of commodities needed to purchase one unit of the exotic cargo for sale
	 */
	ExoticMarket(int cargoForSale, CargoList cargoList)
	{
		this.cargoForSale = cargoForSale;
		this.cargoList = cargoList;
	}	
}

/**
 * 
 * ItemMarket: Result containing a list of inventory items and what commodities are required for their purchase.
 *
 */
class ItemMarket extends Result {
	private MarketItemList marketItemList;
	
	/**
	 * ItemMarket: Result containing a list of inventory items and what commodities are required for their purchase.
	 * @param marketItemList
	 */
	ItemMarket(MarketItemList marketItemList)
	{
		this.marketItemList = marketItemList;
	}
	
	/**
	 * 
	 * @return List of inventory items and their prices
	 */
	MarketItemList getMarketItemList()
	{
		return marketItemList;
	}
}

/**
 * 
 * DroneMarket: Result containing the number of bays a new drone has and its purchase price
 *
 */
class DroneMarket extends Result {
	int droneCapacity;
	CargoList cargoList;
	
	/**
	 * DroneMarket: Result containing the number of bays a new drone has and its purchase price
	 * @param droneCapacity
	 * @param cargoList
	 */
	DroneMarket(int droneCapacity, CargoList cargoList)
	{
		this.droneCapacity = droneCapacity;
		this.cargoList = cargoList;
	}
}

/**
 * 
 * CargoBayExpansion: Result containing the purchase price for a cargo bay expansion.
 *
 */
class CargoBayExpansion extends Result {
	CargoList cargoList;
	
	/**
	 * CargoBayExpansion: Result containing the purchase price for a cargo bay expansion.
	 * @param cargoList
	 */
	CargoBayExpansion(CargoList cargoList)
	{
		this.cargoList = cargoList;
	}	
}

/**
 * 
 * PhaseLoss: Result containing how many extra phases the player loses for selecting this Activity
 *
 */
class PhaseLoss extends Result {
	int phases;
	
	/**
	 * PhaseLoss: Result containing how many extra phases the player loses for selecting this Activity
	 * @param phases
	 */
	PhaseLoss(int phases)
	{
		this.phases = phases;
	}
}

/**
 * 
 * Reading: Result containing a passage number that is shown to the player.
 *
 */
class Reading extends Result {
	int passage;
	
	/**
	 * Reading: Result containing a passage number that is shown to the player.
	 * @param passage
	 */
	Reading(int passage)
	{
		this.passage = passage;
	}
}

/**
 * 
 * Combat: Result containing combat data: the opponent, and which activities to go to for win, lose, and draw based on the combat results.
 *
 */
class Combat extends Result {
	Inventory.Mounting type;
	int opponent;
	int winActivity;
	int loseActivity;
	int drawActivity;
	
	/**
	 * Combat: Result containing combat data: the opponent, and which activities to go to for win, lose, and draw based on the combat results.
	 * @param type - Ship or Personal
	 * @param opponent - index into Opponent list
	 * @param winActivity
	 * @param loseActivity
	 * @param drawActivity
	 */
	Combat(Inventory.Mounting type, int opponent, int winActivity, int loseActivity, int drawActivity)
	{
		this.type = type;
		this.opponent = opponent;
		this.winActivity = winActivity;
		this.loseActivity = loseActivity;
		this.drawActivity = drawActivity;
	}
}
